<template>
	<view class="uni-popup-dialog">


		<view class="f-d j-c">
			<view class="">


				<view class="" style="height: 60rpx;">

				</view>
				<view class="f-d j-c">
					<image src="@/static/tongzhi.png" style="width: 120rpx;height: 120rpx;" mode=""></image>
				</view>
				<view class="f-d j-c pt2">
					<text class="title w800 f34">开启系统通知</text>
				</view>
				<view class="f-d j-c pt2">
					<text class=" f28" style="color: #111522;">开启后将接收订单,提现,回复,点赞消息</text>
				</view>
				<view class="" style="height: 60rpx;">

				</view>
				<view @click="on_kaiqi(0)" class="f-d a-c j-c by1"
					style="background-color: #FE002A;width: 500rpx;height: 80rpx; ">
					<text class="p2 f30" style="color: #fff;">去开启</text>
				</view>
				<view class="" style="height: 60rpx;">

				</view>
				<view class="f-d j-c">

					<view @click="close_a" class="q_y f-d a-c j-c">
						<text class="f28" style="color: #C0C0C0;">不再提醒</text>
					</view>

				</view>

				<view class="f-d j-c pt2">
					<view class="btns">
						<view @click="close" class="q_y f-d a-c j-c"
							style="width: 70rpx;height: 70rpx;background-color: #F0F0F0;">
							<text class="w800" style="color: #F20638;">X</text>
						</view>
					</view>
				</view>
			</view>
		</view>



		<view class=" " style="height:30rpx;">

		</view>


	</view>
</template>

<script>
	import popup from '../uni-popup/popup.js'
	import {
		initVueI18n
	} from '@dcloudio/uni-i18n'
	import messages from '../uni-popup/i18n/index.js'
	const {
		t
	} = initVueI18n(messages)
	/**
	 * PopUp 弹出层-对话框样式
	 * @description 弹出层-对话框样式
	 * @tutorial https://ext.dcloud.net.cn/plugin?id=329
	 * @property {String} value input 模式下的默认值
	 * @property {String} placeholder input 模式下输入提示
	 * @property {String} type = [success|warning|info|error] 主题样式
	 *  @value success 成功
	 * 	@value warning 提示
	 * 	@value info 消息
	 * 	@value error 错误
	 * @property {String} mode = [base|input] 模式、
	 * 	@value base 基础对话框
	 * 	@value input 可输入对话框
	 * @property {String} content 对话框内容
	 * @property {Boolean} beforeClose 是否拦截取消事件
	 * @event {Function} confirm 点击确认按钮触发
	 * @event {Function} close 点击取消按钮触发
	 */

	export default {
		name: "uniPopupDialog",
		mixins: [popup],
		emits: ['confirm', 'close'],
		props: {
			issousuo: {
				type: String,
				default () {
					return '';
				}
			},
			isfenzhong: {
				type: [String, Number],
				default: ''
			},
			value: {
				type: [String, Number],
				default: ''
			},
			money: {
				type: [String, Number],
				default: ''
			},
			sc: {
				type: [String, Number],
				default: ''
			},
			sm: {
				type: [String, Number],
				default: ''
			},
			lei: {
				type: [String, Number],
				default: ''
			},
			li: {
				type: Array,
				default () {
					return [];
				}
			},
			isvip: {
				type: [String, Number],
				default: ''
			},
			placeholder: {
				type: [String, Number],
				default: ''
			},
			type: {
				type: String,
				default: 'error'
			},
			mode: {
				type: String,
				default: 'base'
			},
			title: {
				type: String,
				default: ''
			},
			content: {
				type: String,
				default: ''
			},
			beforeClose: {
				type: Boolean,
				default: false
			},
			cancelText: {
				type: String,
				default: ''
			},
			confirmText: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				dialogType: 'error',
				focus: false,
				val: "",
				tabidnex: 1,
				zd_price: 0
			}
		},
		computed: {
			okText() {
				return this.confirmText || t("uni-popup.ok")
			},
			closeText() {
				return this.cancelText || t("uni-popup.cancel")
			},
			placeholderText() {
				return this.placeholder || t("uni-popup.placeholder")
			},
			titleText() {
				return this.title || t("uni-popup.title")
			}
		},
		watch: {
			type(val) {
				this.dialogType = val
			},
			mode(val) {
				if (val === 'input') {
					this.dialogType = 'info'
				}
			},
			value(val) {
				this.val = val
			}
		},
		created() {


			// 对话框遮罩不可点击
			this.popup.disableMask()
			// this.popup.closeMask()
			if (this.mode === 'input') {
				this.dialogType = 'info'
				this.val = this.value
			} else {
				this.dialogType = this.type
			}
		},
		mounted() {
			this.focus = true
		},
		methods: {
			on_kaiqi() {
				var main = plus.android.runtimeMainActivity();
				var pkName = main.getPackageName();
				var uid = main.getApplicationInfo().plusGetAttribute("uid");
				var Intent = plus.android.importClass('android.content.Intent');
				var Build = plus.android.importClass("android.os.Build");

				if (Build.VERSION.SDK_INT >= 26) {
					var intent = new Intent('android.settings.APP_NOTIFICATION_SETTINGS');
					intent.putExtra('android.provider.extra.APP_PACKAGE', pkName);
				} else if (Build.VERSION.SDK_INT >= 21) { //android 5.0-7.0  
					var intent = new Intent('android.settings.APP_NOTIFICATION_SETTINGS');
					intent.putExtra("app_package", pkName);
					intent.putExtra("app_uid", uid);
				} else { //(<21)其他--跳转到该应用管理的详情页
					var Settings = plus.android.importClass("android.provider.Settings");
					var Uri = plus.android.importClass("android.net.Uri");
					var intent = new Intent();
					intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
					var uri = Uri.fromParts("package", main.getPackageName(), null);
					intent.setData(uri);
				}
				// 跳转到该应用的系统通知设置页  
				main.startActivity(intent);
				this.confirm();
			},
			close_a() {
				uni.setStorage({
					key: 'is_tuisong',
					data: true
				});
				this.close();
			},
			close() {
				this.popup.close()
			}
		}
	}
</script>


<style lang="scss">
	.classify-liv {
		text-align: center;
		align-items: center;
		padding-bottom: 10rpx;
		border: solid 2rpx #FD9A01;
		text-align: center;
		color: #999;
		border-radius: 10rpx;
		width: 200rpx;
		font-size: 24upx;
		margin: 10;

	}

	.classify-lixzlv {
		text-align: center;
		align-items: center;
		padding-bottom: 10rpx;
		border: solid 2rpx #999;

		color: #999;
		border-radius: 10rpx;
		width: 200rpx;
		font-size: 24upx;
		margin: 10;

	}

	.uni-popup-dialog {
		width: 300px;
		border-radius: 11px;
		background-color: #fff;
	}

	.uni-dialog-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		padding-top: 25px;
	}

	.uni-dialog-title-text {
		font-size: 16px;
		font-weight: 500;
	}

	.uni-dialog-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		align-items: center;
		padding-top: 10rpx;
	}

	.uni-dialog-content-text {
		font-size: 14px;
		color: #6C6C6C;
	}

	.f20 {
		font-size: 24rpx;
	}

	.uni-dialog-button-group {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		border-top-color: #f5f5f5;
		border-top-style: solid;
		border-top-width: 1px;
	}

	.uni-dialog-button {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */

		flex: 1;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		height: 45px;
	}

	.uni-border-left {
		border-left-color: #f0f0f0;
		border-left-style: solid;
		border-left-width: 1px;
	}

	.uni-dialog-button-text {
		font-size: 16px;
		color: #333;
	}

	.uni-button-color {
		color: #007aff;
	}

	.uni-dialog-input {
		flex: 1;
		font-size: 14px;
		border: 1px #eee solid;
		height: 40px;
		padding: 0 10px;
		border-radius: 5px;
		color: #555;
	}

	.uni-popup__success {
		color: #4cd964;
	}

	.uni-popup__warn {
		color: #f0ad4e;
	}

	.uni-popup__error {
		color: #dd524d;
	}

	.uni-popup__info {
		color: #909399;
	}
</style>
